<?php

namespace app\admin\model\user;

use think\Model;


class Teacherapply extends Model
{

    

    

    // 表名
    protected $name = 'user_teacherapply';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'auth_status_text'
    ];
    

    
    public function getAuthStatusList()
    {
        return ['待审核' => __('待审核'), '审核通过' => __('审核通过'), '审核失败' => __('审核失败')];
    }
    public function getAuthStatusList1()
    {
        return [ '审核通过' => __('审核通过'), '审核失败' => __('审核失败')];
    }


    public function getAuthStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['auth_status']) ? $data['auth_status'] : '');
        $list = $this->getAuthStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }




    public function teacher()
    {
        return $this->belongsTo('Teacher', 'user_teacher_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}
